$(function() {
	//初始化datatable
	$("#table").XRDataTable({
		ajaxUrl: "Admin/Question/getDatas",
		paramFunc: paramFunc,
		operation: {
			"edit": ["Admin/Question/edit/#id"],			
			"del": [ del,"启用/冻结"]
		},
		hasCheckbox: false
	});

	// exportEvent();
	
});

var paramFunc = function() {
	var data = getFormJson();
	return data;
};


var del=function(idx, trData){
	var id=$("#id").val();
	swal({
		title: "请确认",
		text: "是否确认删除【" + trData.title + "】?",
		type: "warning",
		showCancelButton: true,
		closeOnConfirm: true,
		confirmButtonText: "确定",
		cancelButtonText: '取消',
		confirmButtonColor: "#ec6c62"
	}, function(isConfirm) {
		if(isConfirm) {
			$.ajax({
				type: "post",
				url: $("#url").val()+'Admin/Question/delete/'+trData.id,
				async: true,
				success: function(data) {
					var ret = $.parseJSON(data);
					if(ret.status) {
	                    window.parent.topMessagePrompt('success',ret.msg);
	                    window.parent.refreshTable();
					} else {
						window.parent.topMessagePrompt('error',ret.msg);
					}
				}
			});
		}
	});
}
function imgBigshow(t){
	imgBig($(t).attr('class'));
}
